package com.zsy.servlet;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zsy.service.BBSService;

public class ParseBBS extends HttpServlet {

	@Override
	protected void service(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {

		try {
			String browse_regex = request.getParameter("browsecount");
			String next_regex = request.getParameter("nextreply");
			String reply_regex = request.getParameter("reply");
			String body_regex = request.getParameter("bodyregex");
//			String prefix = request.getParameter("prefix");
			String siteid = request.getParameter("site");
			String encode = request.getParameter("encode");
			String replycount_regex = request.getParameter("replycount");
			String publish_regex = request.getParameter("publish_regex");
			String author_regex = request.getParameter("author_regex");
			BBSService bbs = new BBSService();
			bbs.saveParseBBSConfig(browse_regex, next_regex, reply_regex,
					body_regex, siteid, encode, replycount_regex,publish_regex,author_regex);
			request.getSession().setAttribute("msg", "添加成功!");
			response.sendRedirect(request.getContextPath()+"/allBbsConf");
		} catch (SQLException e) {
			response.sendRedirect(request.getContextPath()+"/allBbsConf");
			e.printStackTrace();
		}
	}

}
